
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>后台登录</title>
<meta name="author" content="DeathGhost" />
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<style>
body{height:100%;background:#16a085;overflow:hidden;}
canvas{z-index:-1;position:absolute;}
</style>
<script src="/js/jquery.js"></script>
<script src="/js/verificationNumbers.js"></script>
<script src="/js/Particleground.js"></script>
<script>
$(document).ready(function() {
  //粒子背景特效
  $('body').particleground({
    dotColor: '#5cbdaa',
    lineColor: '#5cbdaa'
  });
  //验证码
  createCode();
  //测试提交，对接程序删除即可
  $(".submit_btn").click(function(){
	  location.href="index.html";
	  });
});
</script>
</head>
<body>
<dl class="admin_login">
 <dt>
  <strong>易车网后台管理系统</strong>
  <em>Management System</em>
 </dt>
 <form action="" method="post" id="login">
    {!! csrf_field()!!}
     <dd class="user_icon">
      <input type="text" id="zh" name="name"  placeholder="账号" class="login_txtbx"/>
     </dd>
     <dd class="pwd_icon">
      <input type="password" name="password"  placeholder="密码" class="login_txtbx" />
     </dd>
     <dd class="val_icon">
      <div class="checkcode">
        <input type="text" id="J_codetext" placeholder="请输入手机短信验证码" maxlength="4" class="login_txtbx" style="width:180px">
        <!-- <canvas class="J_codeimg" id="myCanvas" onclick="createCode()">对不起，您的浏览器不支持canvas，请下载最新版浏览器!</canvas> -->
      </div>
      <input type="button" value="发送验证码" class="ver_btn" id="fasong">
     </dd>
     <dd>
      <input type="submit" value="立即登陆" class="submit_btn"/>
     </dd>
     <input type="hidden" id="yzdx">
 </form>
 <dd>
  <p>© 2016-2017 DeathGhost 版权所有</p>
  <p>布尔教育21期-易车网</p>
 </dd>
</dl>
</body>
<script>
  var fasong = document.getElementById('fasong');
  var login = document.getElementById('login');
  var codetext = document.getElementById('J_codetext');
  var zh = document.getElementById('zh');
  var yzdx = document.getElementById('yzdx');
  fasong.onclick = function(){
    var ur = '/fasong/' + zh.value;
    var xhr = new XMLHttpRequest();
    xhr.open('get',ur,true);
    xhr.onreadystatechange = function(){
      if(this.readyState == 4){
        if(this.responseText != 0){
          fasong.value = '发送成功';
          fasong.disabled = true;
          yzdx.value = this.responseText;
        }else{
          fasong.value = "发送失败请重发";
        }
      }
    }
    xhr.send(null);
  }

  login.onsubmit = function(){
      if(codetext.value == yzdx.value && codetext.value != ''){
        return true;
      }
      alert('短信验证码错误');
      return false;
  }
</script>
</html>
